from microbit import *

INTERVAL1 = 1000
TIMER1 = INTERVAL1

def task1():
    display.set_pixel(0, 0, 9 - display.get_pixel(0, 0))

INTERVAL2 = 2000
TIMER2 = INTERVAL2
    
def task2():
    display.set_pixel(4, 4, 9 - display.get_pixel(4, 4))

while True:
    if running_time() > TIMER1:
        TIMER1 = TIMER1 + INTERVAL1
        task1()

    if running_time() > TIMER2:
        TIMER2 = TIMER2 + INTERVAL2
        task2()